//
//  Auction_SpecialSaleDetails_Tbv_WX.m
//  ZITHER
//
//  Created by weixin on 2019/5/30.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "Auction_SpecialSaleDetails_Tbv_WX.h"
#import "Auction_SpecialSaleDetailsUserInfo_Cell_WX.h"
#import "Auction_SpecialSaleDetailsPrice_Cell_WX.h"
#import "Auction_SpecialSaleDetailsHongKongPrice_Cell_WX.h"
#import "Auction_SpecialSaleDetailsPreferentialPrice_Cell_WX.h"
#import "Auction_SpecialSaleDetailsWatchInfo_Cell_WX.h"
#import "Auction_SpecialSaleDetailsWatchInfoSpecific_Cell_WX.h"



@implementation Auction_SpecialSaleDetails_Tbv_WX

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self def];
    }
    return self;
}

-(void)def{
    self.type = 1;
    self.delegate = self;
    self.dataSource = self;
    
}

-(void)setModel:(specialSaleSceneidDetails *)model{
    _model = model;
//    [self reloadData];
}


#pragma mark - UITableViewDelegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    NSLog(@"indexPath == %@",indexPath);
    NSLog(@"");

}

#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (self.type ==0) {
        return 6;
    }else{
        return 6;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.type == 0) {
       return [self setDetails:indexPath];
    }else{
       return [self setTaizi:indexPath];
    }
}


-(UITableViewCell *)setTaizi:(NSIndexPath *)indexPath{
    if (indexPath.row ==0) {
        return [self getAuction_SpecialSaleDetailsUserInfo_Cell_WX:indexPath];
    }else if (indexPath.row == 1){
            return [self getAuction_SpecialSaleDetailsHongKongPrice_Cell_WX:indexPath];
    }else if (indexPath.row == 2){
        return [self getAuction_SpecialSaleDetailsPreferentialPrice_Cell_WX:indexPath];
    }else if (indexPath.row == 3){
        return [self getAuction_SpecialSaleDetailsWatchInfo_Cell_WX:indexPath];
    }else if (indexPath.row == 4){
        return [self getAuction_SpecialSaleDetailsWatchInfo_Cell_WX:indexPath];
    }else{
        return [self getAuction_SpecialSaleDetailsWatchInfoSpecific_Cell_WX:indexPath];
    }
}

-(UITableViewCell *)setDetails:(NSIndexPath *)indexPath{
    if (indexPath.row ==0) {
        return [self getAuction_SpecialSaleDetailsUserInfo_Cell_WX:indexPath];
    }else if (indexPath.row == 1){
            return [self getAuction_SpecialSaleDetailsPrice_Cell_WX:indexPath];
    }else if (indexPath.row == 2){
        return [self getAuction_SpecialSaleDetailsHongKongPrice_Cell_WX:indexPath];
    }else if (indexPath.row == 3){
        return [self getAuction_SpecialSaleDetailsWatchInfo_Cell_WX:indexPath];
    }else if (indexPath.row == 4){
        return [self getAuction_SpecialSaleDetailsWatchInfo_Cell_WX:indexPath];
    }else{
        return [self getAuction_SpecialSaleDetailsWatchInfoSpecific_Cell_WX:indexPath];
    }
}

-(UITableViewCell *)getAuction_SpecialSaleDetailsUserInfo_Cell_WX:(NSIndexPath *)indexPath{
    static NSString *sectionCell = @"Auction_SpecialSaleDetailsUserInfo_Cell_WX";
    Auction_SpecialSaleDetailsUserInfo_Cell_WX *cell = [self dequeueReusableCellWithIdentifier:sectionCell];
    if (cell == nil) {
        cell = [[Auction_SpecialSaleDetailsUserInfo_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.model = self.model;
    return cell;
}
-(UITableViewCell *)getAuction_SpecialSaleDetailsPrice_Cell_WX:(NSIndexPath *)indexPath{
    static NSString *sectionCell = @"Auction_SpecialSaleDetailsPrice_Cell_WX";
    Auction_SpecialSaleDetailsPrice_Cell_WX *cell = [self dequeueReusableCellWithIdentifier:sectionCell];
    if (cell == nil) {
        cell = [[Auction_SpecialSaleDetailsPrice_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.model = self.model;

    return cell;
}
-(UITableViewCell *)getAuction_SpecialSaleDetailsHongKongPrice_Cell_WX:(NSIndexPath *)indexPath{
    static NSString *sectionCell = @"Auction_SpecialSaleDetailsHongKongPrice_Cell_WX";
    Auction_SpecialSaleDetailsHongKongPrice_Cell_WX *cell = [self dequeueReusableCellWithIdentifier:sectionCell];
    if (cell == nil) {
        cell = [[Auction_SpecialSaleDetailsHongKongPrice_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.model = self.model;

    return cell;
}
-(UITableViewCell *)getAuction_SpecialSaleDetailsPreferentialPrice_Cell_WX:(NSIndexPath *)indexPath{
    static NSString *sectionCell = @"Auction_SpecialSaleDetailsPreferentialPrice_Cell_WX";
    Auction_SpecialSaleDetailsPreferentialPrice_Cell_WX *cell = [self dequeueReusableCellWithIdentifier:sectionCell];
    if (cell == nil) {
        cell = [[Auction_SpecialSaleDetailsPreferentialPrice_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.model = self.model;

    return cell;
}

-(UITableViewCell *)getAuction_SpecialSaleDetailsWatchInfo_Cell_WX:(NSIndexPath *)indexPath{
    static NSString *sectionCell = @"Auction_SpecialSaleDetailsWatchInfo_Cell_WX";
    Auction_SpecialSaleDetailsWatchInfo_Cell_WX *cell = [self dequeueReusableCellWithIdentifier:sectionCell];
    if (cell == nil) {
        cell = [[Auction_SpecialSaleDetailsWatchInfo_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (self.type == 0) {
        if (indexPath.row ==3) {
            cell.type = 1;
        }else{
            cell.type = 0;
        }
    }else{
        if (indexPath.row ==3) {
            cell.type = 1;
        }else{
            cell.type = 0;
        }
    }
    cell.model = self.model;
    return cell;
}

-(UITableViewCell *)getAuction_SpecialSaleDetailsWatchInfoSpecific_Cell_WX:(NSIndexPath *)indexPath{
    static NSString *sectionCell = @"Auction_SpecialSaleDetailsWatchInfoSpecific_Cell_WX";
    Auction_SpecialSaleDetailsWatchInfoSpecific_Cell_WX *cell = [self dequeueReusableCellWithIdentifier:sectionCell];
    if (cell == nil) {
        cell = [[Auction_SpecialSaleDetailsWatchInfoSpecific_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.model = self.model;

    return cell;
}

@end
